/*
 * Copyright (C) 2014 VenomVendor <info@VenomVendor.com>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package com.naizhuai.ui.adapter.business;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.naizhuai.R;

import java.util.List;

public class ActionImageBrightPointProcessAdapterHolder extends RecyclerView.Adapter {

    private Context mContext;
    private List<String> intList;


    public ActionImageBrightPointProcessAdapterHolder(Context context, List<String> intList) {
        this.mContext = context;
        this.intList = intList;
    }

    @Override
    public int getItemCount() {
        return intList.size();
    }


    @NonNull
    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View sView = LayoutInflater.from(parent.getContext()).inflate(R.layout.adapter_action_list_txt, parent, false);
        return new LineTextHolder(sView);
    }

    @Override
    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
        LineTextHolder lineHolder = (LineTextHolder) holder;
        String strFormat = mContext.getText(R.string.number_format).toString();
        String text = String.format(strFormat, position + 1, intList.get(position));
        lineHolder.numberData.setText(text);
    }

    public class LineTextHolder extends RecyclerView.ViewHolder {
        TextView numberData;

        public LineTextHolder(View view) {
            super(view);
            numberData = view.findViewById(R.id.line_txt);
        }
    }

}
